const Router = require("koa-router");
const main = require("../models");
const { ObjectId } = require("mongodb")
const router = new Router();
router.get("/detail/:id", async ctx => {
    var url = ctx.request.url;
    var id = url.replace(/\/detail\//g, "");
    var table = await main("home");
    var detail = await table.find({ _id: ObjectId(id) }).toArray();
    console.log(detail);
    ctx.body = detail;
})
module.exports = router;